<template>
    <div class="parent">
        <h1>父组件</h1>
        <h2>子组件传来的参数：{{ sonData }}</h2>
        <!-- 给子组件的参数 -->
        <Son  id="1" :data="data" :useSon="getSonPro" />
    </div>
</template>

<script lang="ts">
export default {
name:'Parent'
}
</script>

<script setup lang="ts">
import Son from './Son.vue';
import { ref } from 'vue';

let data = ref('哈哈')
let sonData = ref('')

//定义一个可以接受子组件参数的方法
function getSonPro(value:string) { 
    console.log(value);
    sonData.value = value
}

</script>

<style lang="css">
.parent{
    width: 500px;
    height: 300px;
    background-color:aqua;
}
</style>